<div class="bjui-pageContent">
    <table class="table table-bordered" data-toggle="datagrid" data-options="{
        height: '100%',
        gridTitle : '权限管理',
        showToolbar: true,
        toolbarItem: 'add',
        {{--editMode: 'dialog',--}}
        local: 'local',
        dataUrl: '/admin/user/authority-management',
        editUrl: '/admin/user/save-role',
        delUrl: '/admin/user/del-role',
        delPK: 'id',
        linenumberAll: true,
        sortAll: false,
        contextMenuH: true,
        contextMenuB: true,
        inlineEditMult: false,
        paging: {showPagenum:10, selectPageSize:'20,50,100', pageCurrent:1, pageSize:20},
        showEditbtnscol: '操作',
        customEditbtns: {width:200,position:'replace',buttons:datagrid_tree_operation},
        fullGrid: true,
        fieldSortable: false,
        filterThead: false,
        columnMenu: false,
    }">
        <thead>
        <tr>
            <th data-options="{name:'name',align:'center',width:100}">英文名</th>
            <th data-options="{name:'display_name',align:'center',width:100}">中文名</th>
            <th data-options="{name:'description',align:'center',width:300}">描述</th>
            <th data-options="{align:'center',width:200,render:permission_assignment}">权限分配</th>
        </tr>
        </thead>
    </table>
</div>

<script type="text/javascript">
    function permission_assignment(value, data)
    {
        var html = '<button type="button" class="btn btn-info" data-toggle="navtab" data-options="{id:\'permission_navtab\', url:\'/admin/user/permission-assignment\', title:\'权限分配\', data:{roleId:' + data.id + '}}"><i class="fa fa-sitemap"></i> 权限分配</button>'
        return html
    }

    // 操作列
    function datagrid_tree_operation() {
        var html = '<button type="button" class="btn btn-green bjui-datagrid-btn edit"><i class="fa fa-edit"></i> 编辑</button>'
                + ' <button type="button" class="btn btn-green bjui-datagrid-btn update"><i class="fa fa-edit"></i> 更新</button>'
                + ' <button type="button" class="btn btn-green bjui-datagrid-btn save"><i class="fa fa-check"></i> 保存</button>'
                + ' <button type="button" class="btn btn-orange bjui-datagrid-btn cancel"><i class="fa fa-undo"></i> 取消</button>'
                + ' <button type="button" class="btn btn-red bjui-datagrid-btn delete"><i class="fa fa-remove"></i> 删除</button>'

        return html
    }
</script>